<div class="row trash-area">

  <% if @posts.blank? && @pages.blank? %>

    <div class="col-md-12 text-center">
      <div class="panel panel-default">
        <div class="panel-body">
          <span class="warning-text top-margin-60 bottom-margin-60"><%= t("views.admin.trash.empty") %></span>
        </div>
      </div>
    </div>

    <% end %>

    <% size = respond_to_trash(@posts, @pages) %>

    <% if !@pages.blank? %>

    <div class="col-md-<%= size %>" id="pages">

      <%= form_tag deal_with_form_admin_trash_index_path do %>

        <div class="panel panel-default">
          <div class="panel-heading"><%= t("generic.pages") %>
            <div class="pull-right action-buttons">
              <div class="btn-group pull-right">
                <%= link_to empty_articles_admin_trash_index_path('page'), :class => 'btn btn-danger btn-xs', data: { confirm: t("views.admin.generic.confirm") } do %>
                <i class="fa fa-trash-o"></i>&nbsp;<%= t("views.admin.trash.delete_all") %>
                <% end %> 
              </div>
            </div>
          </div>
          <div class="panel-body">
            <ul class="list-group">
              <% @pages.each do |page| %>

              <li class="list-group-item">
                <%= check_box_tag 'pages[]', page.id %>&nbsp;<span for="checkbox"><%= page.post_title %><%= page.post_status == "Draft" ? t("views.admin.partials.articles_table.draft") : '' %> <small class="hidden-xs">(<%= t("views.admin.trash.published_date", date: page.post_date.strftime("%d-%m-%Y")) %>)</small></span>
              </li>

              <% end %>
            </ul>
          </div>
          <div class="panel-footer">
            <div class="row">
              <div class="col-md-6">
                <%= bulk_update_dropdown Hash[
                                          'reinstate' => t("views.admin.generic.bulk_update_options.reinstate"), 
                                          'destroy' =>  t("views.admin.generic.bulk_update_options.destroy")
                                          ] %>
              </div>
              <div class="col-md-6">
                <h6 class="pull-right"><%= t("views.admin.trash.total") %> <span class="label label-primary"><%= @pages.count %></span></h6>
              </div>
            </div>
          </div>
        </div>

      <% end %>

    </div>

  <% end %>

  <% if !@posts.blank? %>

      <div class="col-md-<%= size %>" id="posts">

        <%= form_tag deal_with_form_admin_trash_index_path do %>

        <div class="panel panel-default">
          <div class="panel-heading"><%= t("generic.articles") %>
            <div class="pull-right action-buttons">
              <div class="btn-group pull-right">
                <%= link_to empty_articles_admin_trash_index_path('post'), :class => 'btn btn-danger btn-xs', data: { confirm: t("views.admin.generic.confirm") } do %>
                <i class="fa fa-trash-o"></i>&nbsp;<%= t("views.admin.trash.delete_all") %>
                <% end %> 
              </div>
            </div>
          </div>
          <div class="panel-body">
            <ul class="list-group">
              <% @posts.each do |post| %>

              <li class="list-group-item">
                <%= check_box_tag 'posts[]', post.id %>&nbsp;<span for="checkbox"><%= post.post_title %><%= post.post_status == "Draft" ? t("views.admin.partials.articles_table.draft") : '' %> <small class="hidden-xs">(<%= t("views.admin.trash.published_date", date: post.post_date.strftime("%d-%m-%Y")) %>)</small></span>
              </li>

              <% end %>
            </ul>
          </div>
          <div class="panel-footer">
            <div class="row">
              <div class="col-md-6">
                <%= bulk_update_dropdown Hash[
                                          'reinstate' => t("views.admin.generic.bulk_update_options.reinstate"), 
                                          'destroy' =>  t("views.admin.generic.bulk_update_options.destroy")
                                          ] %>
              </div>
              <div class="col-md-6">
                <h6 class="pull-right"><%= t("views.admin.trash.total") %> <span class="label label-primary"><%= @posts.count %></span></h6>
              </div>
            </div>
          </div>
        </div>
        <% end %>
      </div>

  <% end %>

</div>